﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace ICAM.ViewModel
{
    public class NothingAlaramViewModule : ViewModelBase
    {
        /// <summary>
        /// 备注
        /// </summary>
        private string remark;
        public string Remark
        {
            get { return remark; }
            set
            {
                remark = value;
                this.OnPropertyChanged("Remark");
            }
        }
        /// <summary>
        /// 确定
        /// </summary>
        public ICommand ConfirmCommand { get; set; }
        /// <summary>
        /// 取消
        /// </summary>
        public ICommand CancelCommand { get; set; }

        private DialogWindow window;
        private AlarmItemViewModule itemViewModule;
        public NothingAlaramViewModule(DialogWindow window, AlarmItemViewModule viewModule)
        {
            this.window = window;
            this.itemViewModule = viewModule;
            CancelCommand = new DelegateCommand(ExecuteCancel);
            ConfirmCommand = new DelegateCommand(ExecuteConfirm);
        }

        /// <summary>
        /// 执行取消
        /// </summary>
        /// <param name="param"></param>
        private void ExecuteCancel(object param)
        {
            this.window.Close();
        }

        /// <summary>
        /// 执行确定
        /// </summary>
        /// <param name="param"></param>
        private void ExecuteConfirm(object param)
        {
            this.itemViewModule.AlarmDealTime = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm");
            this.itemViewModule.AlarmDealType = "已忽略";
            this.itemViewModule.AlarmDealStatus = "1";
            this.itemViewModule.AlarmDealRemake = this.Remark;
            this.window.DialogResult = true;
        }
    }
}
